
from concurrent.futures.thread import ThreadPoolExecutor
from multiprocessing import cpu_count
from apscheduler.executors.pool import ProcessPoolExecutor
from selenium.webdriver.common.by import By

cpu = cpu_count()

executors = {
    'default': {
        'type': 'threadpool',
        'max_workers': cpu/2
    },
    'processpool': ProcessPoolExecutor(max_workers=cpu/4)
}

dependent_data = {
    "id": By.ID,
    "name": By.NAME,
    "class": By.CLASS_NAME,
    "xpath": By.XPATH,
    "css": By.CSS_SELECTOR,
    "tag": By.TAG_NAME,
    "link": By.LINK_TEXT,
    "partial_link": By.PARTIAL_LINK_TEXT
}

def reset_dependent_data():
    global dependent_data

    dependent_data = {
        "id": By.ID,
        "name": By.NAME,
        "class": By.CLASS_NAME,
        "xpath": By.XPATH,
        "css": By.CSS_SELECTOR,
        "tag": By.TAG_NAME,
        "link": By.LINK_TEXT,
        "partial_link": By.PARTIAL_LINK_TEXT
    }

case_thread_pool = ThreadPoolExecutor(cpu/2)

file_thread_pool = ThreadPoolExecutor(cpu/2)

handle_thread_pool = ThreadPoolExecutor(cpu/2)

application_thread_pool = ThreadPoolExecutor(cpu/2)

write_thread_pool = ThreadPoolExecutor(cpu/2)

command_thread_pool = ThreadPoolExecutor(cpu/2)























